<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./jq-3.6.0.js"></script>
</head>

<body>
    <div class="box" style="background-color: red;">
        <div></div>
        <div></div>
        <div></div>
    </div>
</body>
<script>
    var user = {
        name: 'zhangsan',
        age: 18,
        address: {
            sheng: '河南',
            shi: '商丘'
        }
    }
    var user1 = {}
    var user2 = {}
    $.extend(user1, user);
    //浅拷贝
    user1.address.sheng = '河北';
    user1.name = 'xiaoqin';
    console.log(user1);
    console.log(user);
    //深拷贝
    $.extend(true, user2, user);
    user2.address.sheng = '北京';
    console.log(user2);
    console.log(user);
    //--------------------------
    //元素对象的拷贝
    var box = $('.box').get(0)
    var box1 = {};
    $.extend(true, box1, box);
    console.log(box1);
</script>

</html>